Skip to main content

Network Logs

Network logs include information about requests between the web browser and the site being tested. DevAssure provides powerful features for capturing and displaying network logs during test execution. By enabling network log tracing with specifing settings, you can gain insights into your application's network interactions.

Enabling Network Log Tracing:

  • Access the Project Preferences section in the side navigation within DevAssure.

  • Under the Web App settings , enable the "Trace Network Logs" option.

  • Trace Domains:

    • Input the domains of your application to avoid tracking unwanted network logs.
    • If left empty, all domains will be traced.
  • Request Types (Supported):

Currently, DevAssure traces network logs for the following request types:

  • FETCH: For modern web API requests.
  • XHR: For traditional XMLHttpRequest requests.
  • WEBSOCKET: For WebSocket connections.

Other request types (e.g., document, javascript, css) are excluded to avoid memory overload.

Icon

Capturing Network Logs During Test Execution:

DevAssure provides a comprehensive set of test actions for interacting with network logs, allowing you to fetch and verify network interactions within your application.

Icon
ActionDescription
Get Last Network Log Matching (http_method) (url))Retrieves the most recent network log that matches the specified HTTP method and URL.
Get last n network logs (n) matching (http_method) (url))Retrieves the last n network logs that match the specified HTTP method and URL.
Get all network logsFetches all network logs recorded during the test execution.
Get last n network logs (n)Retrieves the last n network logs that match the specified HTTP method and URL.
Verify last network log status (comparator)(status)Verifies if the text content of the HTTP response matches the expected text..
Print all network logsPrints all network logs in the console for debugging purposes.
Print network logs (logs)Prints the specified network logs to the console.
Get network log method (log))Retrieves the HTTP method (e.g., GET, POST) from the specified network log.
Get network log status (log)Retrieves the status code from the specified network log.
Get network log URL (log)RRetrieves the URL of the request from the specified network log.
Get network log request headers (log)Retrieves the request headers from the specified network log.
Get network log response headers (log)Retrieves the response headers from the specified network log.
Get network log response body (log)Retrieves the response body from the specified network log
Get network log request payload (log)Retrieves the payload sent in the request from the specified network log.

Get Last Network Log Matching (http_method) (url)

Retrieves the most recent network log that matches the specified HTTP method and URL.
  • Usage:

    networkLog = Get last network log matching GET https://api.example.com/users

In this example, the action retrieves the last network log entry where the HTTP method is GET and the URL matches https://api.example.com/users

  • Arguments:

    • http_method: The HTTP method to match (e.g., GET, POST).
    • url: The URL or URL pattern to match the network log against.
  • Returns: Returns the network log object that contains details of the matching request and response.

Get last n network logs (n) matching (http_method) (url)

Retrieves the last n network logs that match the specified HTTP method and URL.
  • Usage:

     networkLog = Get last 5 network logs matching POST https://api.example.com/create-user

This action will return the last 5 network logs that were POST requests to the URL https://api.example.com/create-user.

  • Arguments:

    • n: The number of logs to retrieve (e.g., 3).
    • http_method: The HTTP method to match (e.g., POST).
    • url: The URL or URL pattern to match
  • Returns:

    • Returns the last n network logs that match the criteria.

Get all network logs

Fetches all network logs recorded during the test execution.
  • Usage:

    logs = Get all network logs
  • Returns:

    • This action retrieves all network logs for the current test session.

Get last n network logs (n)

Verifies if the text content of the HTTP response matches the expected text.
  • Usage:

    logs = Get last n network logs 10
  • Arguments:

    • n: The number of logs to retrieve (e.g., 10).
  • Returns:

    • This action fetches the last 10 network logs recorded.

Verify last network log status (comparator)(status)

Verifies if the status of the last network log matches the expected status using the comparator.
  • Usage:

    Verify last network logs status==200

  • Arguments:

    • comparator: Comparison operator.
    • status: Expected status code (e.g. 200).
  • Returns:

    • Boolean. Returns true if the value matches the expected value according to the specified comparator, otherwise false.
Prints all network logs in the console for debugging purposes.
  • Usage:

    Print all network logs

Prints the specified network logs to the console.
  • Usage:

    Print network logs networkLogs

Get network log method (log)

Retrieves the HTTP method (e.g., GET, POST) from the specified network log.
  • Usage:

    http_method_11 = Get network log method networkLogs
  • Arguments:

    • log: The network log object from which to retrieve the method.
  • Returns: Returns the HTTP method as a string (e.g., "GET").

Get network log status (log)

Retrieves the status code from the specified network log.
  • Usage: status = Get network log status networklog

This action extracts the status code from the log object.

  • Arguments:

    • log: The network log object from which to retrieve the method.
  • Returns: Returns the HTTP status code (e.g., 200).

Get network log URL (log)

Retrieves the URL of the request from the specified network log.
  • Usage:

    url = Get network log url networklog
  • Arguments:

    • log: The network log object from which to retrieve the url.
  • Returns:

    • Returns the URL as URL Object.

Get network log request headers (log)

Retrieves the request headers from the specified network log..
  • Usage:

    headers = Get network log request headers networklog
  • Returns:

    • Returns the request headers as an object containing key-value pairs.

Get network log response headers (log)

Retrieves the response headers from the specified network log.
  • Usage:

    headers = Get network log response headers networklog
  • Returns:

    • Returns the response headers as an object containing key-value pairs.

Get network log response body (log)

Retrieves the response body from the specified network log.
  • Usage:

    responseBody = Get network log response body networklog
  • Returns:

    • Returns the response headers as an object containing key-value pairs.

Get network log request payload (log)

Retrieves the payload sent in the request from the specified network log.
  • Usage:

    requestPayload = Get network log request payload networklog
  • Arguments:

    • log: The network log object from which to retrieve the payload.